import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class LetterCount {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String str = scan.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            map.put(str.charAt(i), map.getOrDefault(str.charAt(i), 0) + 1);
        }
        Map.Entry ret = null;
        int max = 0;
        for (Map.Entry entry : map.entrySet()) {
            if (ret == null) {
                ret = entry;
                max = (int) entry.getValue();
            }
            if ((int) entry.getValue() == max && (char) entry.getKey() < (char) ret.getKey()) {
                ret = entry;
                max = (int) entry.getValue();
            }
            if ((int) entry.getValue() > max) {
                ret = entry;
                max = (int) entry.getValue();
            }
        }
        System.out.println(ret.getKey());
        System.out.println(max);
        scan.close();
    }
}
